perm filename RSLV.FAI[S,NET] blob sn#824074 filedate 1986-09-03 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		TITLE RSLV  A P PDLEN PDL RSLV READ MAIN CHKHST FLSHST HSTTAB
C00005 ENDMK
C⊗;
	TITLE RSLV ;⊗ A P PDLEN PDL RSLV READ MAIN CHKHST FLSHST HSTTAB

;Interim resolver program.  This program holds the host table in an
;upper segment so that other programs can attach to it.  Eventually
;it will communicate with jobs using the domain resolver interface,
;in preparation for having a real resolver.

PRINTS/Save as ↓[RSLV]↓.DMP[NET,SYS]
/

A←1
P←17
PDLEN←20

PDL:	BLOCK PDLEN

RSLV:	RESET
	MOVE P,[IOWD PDLEN,PDL]
	IRUMSK [0]		;No I-level code, interrupts just wake up main program
READ:	PUSHJ P,ATTHST		;Read host table into upper segment
MAIN:	CLKINT =60*=60		;Sleep for 60 seconds
	IWAIT
	PUSHJ P,CHKHST		;See if the host table changed
	 JRST MAIN		;No change
	PUSHJ P,FLSHST		;Yes, flush our upper segment
	JRST READ		;And get a new one

;An obsolete host table is indicated by some other job changing the name of
;our high segment.
CHKHST:	SEGNAM A,		;Get name of upper segment
	CAME A,HSGNAM		;Is it what we expect?
	AOS (P)			;No
	POPJ P,			;Yes

;The host table is flushed by releaseing our high segment.  We can't just
;read the new table into the same segment, because someone might be in the
;midst of using the current one.
FLSHST:	SETZB A,HSTADR
	CORE2 A,		;Get rid of our upper segment
	 JFCL			;Impossible error
	POPJ P,

HSTTAB←←-1
.INSERT NETWRK.FAI[S,NET]

	END RSLV